package com.boot.project.service.impl;

import com.boot.project.dao.SignInfoDao;
import com.boot.project.domain.SignInfoDo;
import com.boot.project.service.SignInfoService;
import org.omg.CORBA.INTERNAL;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class SignInfoServiceImpl implements SignInfoService {
    @Autowired
    private SignInfoDao signInfoDao;

    @Override
    public Map<String, Object> sign(SignInfoDo signInfoDo) {
        Map<String, Object> mapResult = new HashMap<>();
        mapResult.put("msg","ok");
        mapResult.put("code",200);

        signInfoDao.sign(signInfoDo);
        return mapResult;
    }

    @Override
    public Map<String, Object> signedInfo(Integer pageNum, Integer pageSize, Integer signType) {
        Map<String, Object> result = new HashMap<>();
        Map<String, Object> params = new HashMap<>();

        Integer startIndex = (pageNum - 1) * pageSize;
        params.put("startIndex",startIndex);
        params.put("pageSize",pageSize);
        params.put("signType",signType);

        result.put("data", signInfoDao.signedInfo(params));
        result.put("total",signInfoDao.count(params));
        return result;
    }
}
